<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>区域运营商列表</title>
		<link rel="stylesheet" href="__OEM__/css/iconfont.css" />
		<link rel="stylesheet" href="__OEM__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<!--右侧内容-->
					<div class="rigtop">
						<span class="title">区域运营商列表</span>
					</div>
					<div class="indrig_con" style="position: relative;">
						{if $Think.session.user_level==2 && $Think.session.user_type==1}
						<div class="zizh_btnbox" style="top: -58px;right:30px">
							
							<button class="zizh_btn" type="button"><i class="iconfont icon-jia"></i>增加区域运营商</button>
						</div>
						{/if}
						<div class="zizh_conbox">
							<!--选项卡内容开始-->
							<form id="my_form" action="{:url('accounts/agency_id2')}" method="post">
								
								<div class="shxx_row chax_row clearfix">
								 {if $Think.session.user_level==1}
									<div class="left">省级代理：</div>
									<div class="right clearfix">
										<div id="htselect">
											<select name="province_id" id="ch_city">
												<option value="">全部</option>
												{volist name="province" id="str"}
												<option {if $province_id==$str.id} selected {/if} value="{$str.id}">{$str.user_name}</option>
												{/volist}
											</select>
										</div>
									</div>
									{/if}
									{if $Think.session.user_level==1 || $Think.session.user_level==4}
									<div class="left"  style="margin-left: 10px;">市级代理：</div>
									<div class="right clearfix">
										<div id="htselect">
											<select name="agency_id" id="ch_city">
												<option value="">全部</option>
												{volist name="agency" id="vo"}
												<option {if $agency_id==$vo.id} selected {/if} value="{$vo.id}">{$vo.user_name}</option>
												{/volist}
											</select>
										</div>
									</div>
									{/if}
									<div class="left"  style="margin-left: 10px;">运营手机号：</div>
									<div class="right clearfix">
												<input type="text" name="mobile" id="mobile" value="{$mobile?$mobile:''}" placeholder="区域运营商手机号" class="chax_input" />
									</div>
									<div class="left"  style="margin-left: 10px;">运营商名称：</div>
									<div class="right clearfix">							
												<input type="text" name="user_name" id="user_name" value="{$user_name?$user_name:''}" placeholder="区域运营商名称" class="chax_input" />
									</div>

									<button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
								</div>
							</form>

							<div class="zizh_con_1">
								<div class="chax_conbox">
									<div class="chax_jieg">总计：{$list->total();}家</div>
									<div class="chax_jiegnr">
										<table class="zizh_table1 zizh_table2">
											<thead>
												<tr style="text-align: center;">
													<th>运营商ID</th>
													<th>运营商名称</th>
													{if $Think.session.user_level==1 || $Think.session.user_level==4}
													<th>市代理商</th>
													{/if}
													<th>手机号</th>
													<th>所在城市</th>
													<th>负责区域</th>
													<th style="width: 8%;">余额</th>
													<th width="8%">是否认证</th>
													<th width="8%">分佣<br />比例</th>
													<th width="8%">专员数</th>
													<th width="8%">状态</th>
													<th width="10%">创建时间</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody id="tbody">
												{volist name="list" id="ad" empty="$empty"}
												<tr style="text-align: center;">
													<td>{$ad.id}</td>
													<td>{$ad.user_name}</td>
													{if $Think.session.user_level==1 || $Think.session.user_level==4}
													<td>{$ad.tname}</td>
													{/if}
													<td>{$ad.mobile}</td>
													<td>{$ad.city}</td>
													<td>{$ad.area}</td>
													<td>
														<a href="{:url('index/yue_record1',['id'=>$ad.id])}">
														<?php echo substr($ad['balance'],0,strlen($ad['balance'])-2)?>
														</a>
													</td>
													<td>
														{if $ad.is_verify==1} 是 {else/} 否 {/if}
													</td>
													<td>{$ad.oem_bili}%</td>
													<td>
														{if $Think.session.user_level==2||$Think.session.user_level==1}
														<a href="/oem/accounts/pt_user/agency_id2/{$ad['id']}">
															{$ad.count?$ad.count : 0}
														</a>
														{else/}
														<a href="javascript:;show_member({$ad['id']})">
															{$ad.count?$ad.count : 0}
														</a>
														{/if}
													</td>
													<td>
														{if $ad.status==1} 正常 {else/} 冻结 {/if}
													</td>
													<td>{$ad.add_time|substr=0,10}</td>
													<td>
														<a onclick="open_edit('{$ad.id}')">编辑</a>
														<!--{if $Think.session.user_level == 1}
														<a href="javascript:;" onclick="show_city_pt('{$ad.id}')" class="green" style="width: 65px;margin-top: 2px;">设置推荐人</a>
														{/if}-->
														<a href="javascript:;" onclick="agent_count('{$ad.id}','1')">统计</a>
													</td>
												</tr>

												{/volist}
											</tbody>
										</table>
										<div class="fenye" style="display: block;">
											<ul class="pagination">
												{$list->render()}
											</ul>
										</div>
									</div>
								</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}

	</body>
	<script>
		$(".zizh_btn").click(function() {
			layer.open({
				type: 2,
				title: '添加区域运营商',
				shadeClose: true,
				shade: 0.8,
				area: ['600px', '640px'],
				content: "{:url('accounts/add_agency2')}"
			});
		})

		function open_edit(id) {
			var url = 'edit_agency2?id=' + id;
			layer.open({
				type: 2,
				title: '编辑区域运营商',
				shadeClose: true,
				shade: 0.8,
				area: ['640px', '600px'],
				content: [url]
			});
		}

		function show_city_pt(city_id) {

			var show_url = "{:url('accounts/show_province_pt')}" + '?city_id=' + city_id;

			layer.open({
				type: 2,
				title: '设置推荐人',
				shadeClose: true,
				shade: 0.8,
				area: ['460px', '260px'],
				content: show_url
			});
		}

		function show_score(id) {

			var show_url = "{:url('accounts/show_score')}" + '?type=1&id=' + id;

			layer.open({
				type: 2,
				title: '鼓励金记录',
				shadeClose: true,
				shade: 0.8,
				area: ['775px', '700px'],
				content: show_url
			});
		}

		function show_member(id) {

			var show_url = "{:url('accounts/show_city_member')}" + '?id=' + id;

			layer.open({
				type: 2,
				title: '推广数',
				shadeClose: true,
				shade: 0.8,
				area: ['800px', '730px'],
				content: show_url
			});
		}
		
		//统计
		function agent_count(id){
			var show_url = "{:url('accounts/oem_count')}"+'?id='+id+'&level=2';
			layer.open({
				type: 2,
				title: '数据统计',
				shadeClose: true,
				shade: 0.8,
				area: ['900px', '730px'],
				content: show_url
			});
		}
	</script>

</html>